<?php
	/**
	 * CustomControllerAction
	 * @author David Ivins
	 */
	class CustomControllerAction extends Zend_Controller_Action
	{
		protected $_s3;
		protected $_sdb;
		protected $_config;
		protected $_logger;
		
		/**
		 * init
		 */
		public function init()
		{
			$this->_s3 = Zend_Registry::get('s3');
			$this->_sdb = Zend_Registry::get('sdb');
			$this->_config = Zend_Registry::get('config');
			$this->_logger = Zend_Registry::get('logger');
		}
		
		/**
		 * getUrl
		 */
		public function getUrl($action = null, $controller = null)
		{
			$url = rtrim($this->getRequest()->getBaseUrl(), '/') . '/';
			$url .= $this->_helper->url->simple($action, $controller);
			return '/' . ltrim($url, '/');
		}
		
		/**
		 * preDispatch
		 */
		public function preDispatch()
		{
			$auth = Zend_Auth::getInstance();
			
			if ($auth->hasIdentity())
			{
				$this->view->authenticated = true;
				$this->view->identity = $auth->getIdentity();
			}
			else
				$this->view->authenticated = false;
		}
		
		/**
		 * postDispatch
		 */
		public function postDispatch() { }
	}
